<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="../assets/js/vue.js"></script>
    <title>v-bind 案例</title>
</head>

<body>
    <h1>v-bind 案例</h1>
    <hr>
    <div id="app">
        <img v-bind:src="imgSrc" width="200px">
        <br/>
        <a :href="jspang" target="_blank">技术胖</a>
        <hr>
        <div :class="className">1、绑定classA</div>
        <div :class="{classA:isOk}">2、绑定class中的判断</div>
        <div :class="[classA,classB]">3、绑定class中的数组</div>
        <div :class="isOk?classA:classB">4、绑定class中的三元表达式判断</div>
        <hr>
        <input type="checkbox" id="isTrue" v-model="isOk">
        <label for="isTrue">isOk={{isOk}}</label>
        <hr>
        <div :style="{color:red,fontSize:font}">5、绑定style</div>
        <div :style="styleObject">6、用对象绑定style样式</div>

    </div>
    <style>
        .classA {
            color: red;
        }

        .classB {
            font-size: 150%
        }
    </style>

    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                imgSrc: 'http://jspang.com/wp-content/uploads/2017/02/vue01-2.jpg',
                jspang: 'http://jspang.com',
                className: 'classA',
                isOk: false,
                classA: 'classA',
                classB: 'classB',
                red: 'red',
                font: '30px',
                styleObject: {
                    fontSize: '24px',
                    color: 'green'
                }
            }
        })
    </script>
</body>

</html>